* lisp/help-fns.el (describe-function-1): Test for an autoload before a macro
authorGlenn Morris <rgm@gnu.org>
Mon, 5 May 2014 21:33:07 +0000 (17:33 -0400)
committerGlenn Morris <rgm@gnu.org>
Mon, 5 May 2014 21:33:07 +0000 (17:33 -0400)
since `macrop' works on autoloads.

* test/automated/help-fns.el: New file.

Fixes: debbugs:17410
lisp/ChangeLog
lisp/help-fns.el
test/ChangeLog
test/automated/help-fns.el [new file with mode: 0644]

index 9b21fd8cd6684a5905be30acdd19946e349a6352..3bbacb85e979599dc63dff39113fcf5863978ea1 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-05  Glenn Morris  <rgm@gnu.org>
+
+       * help-fns.el (describe-function-1): Test for an autoload before a
+       macro, since `macrop' works on autoloads.  (Bug#17410)
+
 2014-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * electric.el (electric-indent-functions-without-reindent): Add yaml.
index a186254123d99cf62e8ce6274d3d52898a76fd34..5b0739ed9aeb80766fd7f0cbe2627f6be883286d 100644 (file)
@@ -1,7 +1,6 @@
 ;;; help-fns.el --- Complex help functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2014 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2014 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help, internal
@@ -479,6 +478,11 @@ FILE is the file where FUNCTION was probably defined."
                 ;; aliases before functions.
                 (aliased
                  (format "an alias for `%s'" real-def))
+                ((autoloadp def)
+                 (format "%s autoloaded %s"
+                         (if (commandp def) "an interactive" "an")
+                         (if (eq (nth 4 def) 'keymap) "keymap"
+                           (if (nth 4 def) "Lisp macro" "Lisp function"))))
                 ((or (eq (car-safe def) 'macro)
                      ;; For advised macros, def is a lambda
                      ;; expression or a byte-code-function-p, so we
@@ -491,11 +495,6 @@ FILE is the file where FUNCTION was probably defined."
                  (concat beg "Lisp function"))
                 ((eq (car-safe def) 'closure)
                  (concat beg "Lisp closure"))
-                ((autoloadp def)
-                 (format "%s autoloaded %s"
-                         (if (commandp def) "an interactive" "an")
-                         (if (eq (nth 4 def) 'keymap) "keymap"
-                           (if (nth 4 def) "Lisp macro" "Lisp function"))))
                 ((keymapp def)
                  (let ((is-full nil)
                        (elts (cdr-safe def)))
index 7d4e9d5e68794b3e1dcb71ce2d88c267da586405..a02b8e80395c320fec2d5959f2dc2dd2ed473618 100644 (file)
@@ -1,3 +1,7 @@
+2014-05-05  Glenn Morris  <rgm@gnu.org>
+
+       * automated/help-fns.el: New file.
+
 2014-04-25  Michael Albinus  <michael.albinus@gmx.de>
 
        * automated/tramp-tests.el (top):
diff --git a/test/automated/help-fns.el b/test/automated/help-fns.el
new file mode 100644 (file)
index 0000000..153de7f
--- /dev/null
@@ -0,0 +1,37 @@
+;;; help-fns.el --- tests for help-fns.el
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Maintainer: emacs-devel@gnu.org
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+
+(autoload 'help-fns-test--macro "help-fns" nil nil t)
+
+(ert-deftest help-fns-test-bug17410 ()
+  "Test for http://debbugs.gnu.org/17410 ."
+  (describe-function 'help-fns-test--macro)
+  (with-current-buffer "*Help*"
+    (goto-char (point-min))
+    (should (search-forward "autoloaded Lisp macro" (line-end-position)))))
+
+;;; help-fns.el ends here